package com.springboot.study.controller;

import com.springboot.study.listener.MyTestEvent;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: guodong
 * @Date: 2021/5/13 10:29
 * @Version: 1.0
 * @Description:
 */
@RestController
@RequestMapping("testEventController")
public class MyTestEventController {

    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    @RequestMapping(value = "/testPublishEvent1" )
    public void testPublishEvent(){
        applicationEventPublisher.publishEvent(new MyTestEvent(this, "我来了"));
    }

}
